<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <div id="box">
    </div>

    <script src="./js/react.js"></script>
    <script src="./js/react-dom.js"></script>
    <script src="./js/babel.min.js"></script>

    <script type="text/babel">


        const books = [
            {
                name: "三国演义",
                author: "罗贯中"
            },
            {
                name: "西游记",
                author: "吴承恩"
            }
        ];

        function showBooks() {

            return books.map(item => {
                return (
                    <li>
                        <p>书名:{item.name}</p>
                        <p>作者:{item.author}</p>
                    </li>
                )
            })
        }

        const book = (<div>
            <h1>书籍的信息：</h1>
            <ul>
                {showBooks()}
            </ul>
            <hr />
            <ul>
                {
                    books.map(item =>(
                            <li>
                                <p>书名:{item.name}</p>
                                <p>作者:{item.author}</p>
                            </li>
                        ))
                }
            </ul>
        </div>
        );

        ReactDOM.render(book, document.getElementById("box"));


    </script>
</body>

</html>